home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.09 Sep 89 / MacApp Code / QPlot - McMath / UQPlot.p < prev   
Encoding:
Text File  |  1989-04-25  |  3.1 KB  |  103 lines  |  [TEXT/MPS ]

  1. {Copyright © 1988 by Charles F. McMath  All rights reserved.}
  2.  
  3. UNIT UQPlot;
  4.  
  5. INTERFACE
  6.  
  7. USES
  8.         { • MacApp - this includes all of the things necessary from the MacApp Library }
  9.         UMacApp, 
  10.  
  11.         { • Building Blocks }
  12.         UDialog, UPrinting,
  13.  
  14.         { • Implementation Use }
  15.         SANE, ToolUtils, Fonts, Resources, Script, PickerIntf, Packages;
  16.  
  17.  
  18. CONST
  19.  
  20.     kSignature            =    'FGT3'; {Application signature}
  21.     kFileType            =    'PICT';    {our filetype }
  22.     kQPlotWindowID        =     1001;    
  23.  
  24. TYPE
  25.  
  26.     TQPlotApplication = OBJECT(TApplication)
  27.         fDefGraph:        INTEGER;        { Graph color index }
  28.         fDefAxis:        INTEGER;        { Axis color index }
  29.         fDefBack:        INTEGER;        { Background color index }
  30.         fPrintOpt:        INTEGER;        { Page/Window size }
  31.         
  32.         PROCEDURE TQPlotApplication.IQPlotApplication(
  33.                 itsMainFileType: OSType);
  34.         FUNCTION  TQPlotApplication.DoMakeDocument(
  35.                 itsCmdNumber: CmdNumber): TDocument; OVERRIDE;
  36.         PROCEDURE TQPlotApplication.HandleFinderRequest; OVERRIDE;
  37.         PROCEDURE TQPlotApplication.DoSetupMenus; OVERRIDE;
  38.         FUNCTION TQPlotApplication.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
  39.         PROCEDURE TQPlotApplication.ShowAboutApp;
  40.         END;
  41.  
  42.  
  43.     TQPlotDocument = OBJECT(TDocument)
  44.         fAParam:        Real;            { these parameters }
  45.         fBParam:        Real;            {  correspond to those }
  46.         fCParam:        Real;            {  in the quadratic }
  47.         fStep:            Real;            {  equation. }
  48.         fXScale:        INTEGER;        { X axis scale }
  49.         fYScale:        INTEGER;        { Y axis scale }
  50.         
  51.         fResult:        INTEGER;        { real results? }
  52.         fRoot1:            REAL;            { first root }
  53.         fRoot2:            REAL;            { second root }
  54.  
  55.         fPlotView:    TQPlotView;
  56.  
  57.  
  58.         PROCEDURE TQPlotDocument.IQPlotDocument(itsFileType, itsCreator: OSType;
  59.                                         usesDataFork, usesRsrcFork: BOOLEAN;
  60.                                         keepsDataOpen, keepsRsrcOpen: BOOLEAN);
  61.         PROCEDURE TQPlotDocument.DoMakeWindows; OVERRIDE;
  62.         PROCEDURE TQPlotDocument.DoMakeViews(forPrinting: BOOLEAN); OVERRIDE;
  63.  
  64.         PROCEDURE TQPlotDocument.PosePlotDialog;
  65.         PROCEDURE TQPlotDocument.Quad(a, b, c : REAL;VAR x1, x2 : REAL;
  66.                                 VAR result : INTEGER);
  67.         FUNCTION TQPlotDocument.SolveIt(a, b, c: REAL; VAR x1, x2: REAL): INTEGER;
  68.  
  69.         PROCEDURE TQPlotDocument.DoNeedDiskSpace(VAR dataForkBytes,
  70.                                     rsrcForkBytes: LONGINT); OVERRIDE;
  71.         PROCEDURE TQPlotDocument.DoWrite(aRefNum: INTEGER; makingCopy: BOOLEAN); OVERRIDE;
  72.         END;
  73.  
  74.  
  75.     TQPlotView = OBJECT(TView)
  76.         fPlotDoc:        TQPlotDocument;        { link to the doc }
  77.         fOnePage:        BOOLEAN;            { if TRUE, constrain to page size }
  78.         fDrawing:        PicHandle;            { our picture! }
  79.  
  80.         PROCEDURE TQPlotView.IQPlotView(theDoc: TQPlotDocument; theGrafColor,
  81.                             theAxisColor, theBackColor: INTEGER);
  82.         PROCEDURE TQPlotView.Free; OVERRIDE;
  83.  
  84.         PROCEDURE TQPlotView.CalcMinSize(VAR minSize: VPoint); OVERRIDE;
  85.         PROCEDURE TQPlotView.DoSetupMenus; OVERRIDE;
  86.         FUNCTION TQPlotView.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
  87.         
  88.         PROCEDURE TQPlotView.PrQDStuff(pRect : rect; QDdevice : integer);
  89.         PROCEDURE TQPlotView.SuperViewChangedSize (delta: VPoint;
  90.                         invalidate: BOOLEAN); OVERRIDE;
  91.         PROCEDURE TQPlotView.Resize (width, height: VCoordinate;
  92.                         invalidate: BOOLEAN); OVERRIDE;
  93.         PROCEDURE TQPlotView.Draw(area: Rect); OVERRIDE;
  94.         END;
  95.  
  96.  
  97. IMPLEMENTATION
  98.  
  99. {$I UQPlot.inc1.p}
  100.  
  101. END.
  102.  
  103.